var PrintWarehouseTemplate = function () {
  var template = /*html*/ `
    <div class="print-warehouse-template" style="padding: 0px 20px 20px; height: calc(100% - 20px);">
      <div style="margin-bottom:10px">
        <el-button type="primary" @click="toPrint">打印</el-button>
      </div>
      <div style="height:calc(100% - 50px);overflow:auto;" v-if="printTemplData!==null&&printTemplate!==null">
        <sys-print-template-order ref="printTemplateOrder" :print-data="printTemplData" :print-template="printTemplate" :read-only="readOnly">
        </sys-print-template-order>
      </div>
    </div>
  `;

  return {
    mixins: [printOrderTemplateMixin('inoutWarehouseOrder')],

    methods: {
      setPrintData: function () {
        var printData = _.clone(this.printData);
        for (var i = 0; i < printData.length; i++) {
          var data = printData[i];
          var inCountPrice = data.inCountPrice;
          if (inCountPrice === null) {
            inCountPrice = 0;
          }
          var count = data.count;
          var sumPrice = inCountPrice * count;
          sumPrice = _.round(sumPrice, 3);
          data.sumPrice = sumPrice;
        }

        var data = {
          orderData: printData,
          tableHead: {
            customerName: _.get(printData, '[0].customerName', ''),
            date: moment().format('YYYY-MM-DD')
          }
        };

        var self = this;
        SysUtil.getUser().then(function(user){
          data.user = user;
          self.printTemplData = data;
        });
      }
    },

    template: template
  };
}();